
export class MyButtonAttachment {
    // JS 语法
    constructor() {
        this.title = "附件"; // 自定义菜单标题
        this.iconSvg = '<svg t="1663656865268" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3203" width="200" height="200"><path d="M896.170667 497.365333l-241.365334 241.365334-60.330666-60.373334 180.992-180.992-180.992-181.034666L654.805333 256l241.365334 241.365333z m-647.509334 0l181.034667 180.992-60.330667 60.373334L128 497.365333 369.365333 256l60.330667 60.330667-181.034667 181.034666z" fill="#000000" p-id="3204"></path></svg>' // 可选
        this.tag = "button";
    }
    getValue(editor) {
        console.log(editor.customConfig)
        return editor.getSelectionText();
    }
    isActive(editor) {
        return false;
    }

    isDisabled(editor) {
        return editor.getSelectionText() === '';
    }
    // 点击菜单时触发的函数
    exec(editor, value) {
        if (this.isDisabled(editor)) return;
        const html = `<attachment>${value}123344</attachment>`
        const node = { type: 'attachment', children: [{ text: 'simple text' }] }
        editor.insertNode(node)
        editor.dangerouslyInsertHtml(html); // value 即 this.value(editor) 的返回值
    }
    getModalContentElem(editor) {
        console.log('fff')
        const $content = document.createElement("div");
        this.$content = $content
        return $content
    }

}